﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
//using Google.API.Translate;
namespace DBA.App.Dictionary
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();           
           
        }

        private void button1_Click(object sender, EventArgs e)
        {
            rtfResult.Text=GoogleTranslater.Translate(rtfText.Text,
                cmbFromLanguage.SelectedValue.ToString(), cmbToLanguage.SelectedValue.ToString());                    
        }

       
        private void Form2_Load(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();
            ds.ReadXml("dict.xml");
            DataTable dt = ds.Tables["Language"];
            cmbFromLanguage.DataSource = dt;
            cmbFromLanguage.DisplayMember = "name";
            cmbFromLanguage.ValueMember = "id";
            DataSet ds2 = new DataSet();
            ds2.ReadXml("dict.xml");
            DataTable dt2 = ds2.Tables["Language"];
            cmbToLanguage.DataSource = dt2;
            cmbToLanguage.DisplayMember = "name";
            cmbToLanguage.ValueMember = "id";
            rtfText.Focus();
            rtfText.Select();  
            //cmbFromLanguage.DataSource= 
            
        }

        private void rtfText_TextChanged(object sender, EventArgs e)
        {
            button1_Click(sender, e);
        }

        private void cmbFromLanguage_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }
    }
}
